package collection遍历方法;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.function.Consumer;

public class 增强for {
    public static void main(String[] args) {
        Collection<String> c = new ArrayList<>();
        c.add("Java");
        c.add("HTML");
        c.add("MySQL");
        c.add("Java");

        for (String ele : c) {
            System.out.println(ele);
        }

        double[] scores = {100,99.5,86.0,9.5,25.1,2.3,52.5};
        for (Double score : scores) {
            System.out.println(score);
        }

        c.forEach(new Consumer<String>() {
            @Override
            public void accept(String s) {
                System.out.println(s);
            }
        });


        System.out.println("==============================================");

        c.forEach(s->{
            System.out.println(s);
        });
    }
}